package com.myh.service;

import com.myh.dao.UserInfoDao;
import com.myh.entity.UserInfo;
import com.myh.service.interfaces.IUserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;


@Service  //用于标注业务层组件
public class UserInfoServiceImpl implements IUserInfoService{


    @Autowired //它可以对类成员变量、方法及构造函数进行标注，完成自动装配的工作
    private UserInfoDao userInfoDao;

    public String registerUser(Map<String, Object> map) {

        int code = userInfoDao.insertUserInfo(map);
        return code+"";
    }

    /**
     * 做业务处理工作
     * @param map
     * @return
     */
    public String loginUser(Map<String, Object> map) {
        UserInfo userInfo = userInfoDao.login(map);

        if (userInfo.getPas().equals(map.get("pas").toString()))
        {
            return "success";
        }else{
            return "fail";
        }
    }
}

